package com.heima.shopweb.mapper;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.heima.shopweb.model.Cart;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

@Mapper
public interface CartMapper extends BaseMapper<Cart> {
    default List<Cart> findByMemberId(Integer memberId){
        LambdaQueryWrapper<Cart> queryWrapper = Wrappers.lambdaQuery(Cart.class)
                .eq(Cart::getMemberId, memberId);
        return selectList(queryWrapper);
    }
}
